module.exports = {
  setCookie(key, data, success, fail) {
    wx.setStorage({
      key: key,
      data: data,
      success() {
        success && success()
      },
      fail() {
        fail && fail()
      }
    })
  },
  getCookie(key, success, fail) {
    wx.getStorage({
      key: key,
      success(res) {
        if (res && (res.errMsg == 'getStorage:ok')) {
          success && success(res.data)
        }
      },
      fail() {
        fail && fail()
      }
    })
  },
  deleteCookie(key, success, fail) {
    wx.removeStorage({
      key: key,
      success() {
        success && success()
      },
      fail() {
        fail && fail()
      }
    })
  }
} 